Add check for diagonals

* Also replaced the X and Y modules with atoms.