refactored to have maze be an export of mazeLogic