added findMax and findMin methods