two maze functions