Fixed BFS search, added genStates()