Implemented grid logic.
Continued on update