Added new enum to represent the state of the data. Restructred some things to use it and fixed an error.