Added initial version of function maxes.
bug fixes: new function maxes now works