minor cleanup and added height as parameter