updated main and maze functions