Added visitedStatesDict - only thing left to do in P2