Optimize grids. Always mark squares you can't get away from anymore as non-movable