added max_height function