Modified calculation of walls, removing bug.