making the max recursive