made the height2 function function and tested it