Solved the height function