added expansion of the maximum' recursion function