horizontal and vertical checking done