Added support for entering and exiting a maze anywhere along top and bottom rows