added working code for everything but vertical and diagonal