created a directive for the background height function as more elegant solution