added direction class and worked out validity in all directions. Flipping no broken.