split height invert and filter into seperate functions