Added a working grid and the algarythm