Did some refactoring on the states, fixed some wrong variables

Git ignore corrected