fixed some performance and clarity issues; added new Maze class