added generic max function. *dances*