legal function