simplify code for horizontal