Did some refactoring and added a sample state