Implemented findmax and findmin