Adding grid traversal code

This should theoretically work but it doesn't.