Implemented MIN and MAX