Add max and range functions