added findMin and findMax plus cleanup