implementation of states
Finished master states and tests