implemented solveMazeRec
shortened solveMazeRec function a bit