Changing the states over to a map and building an initial state