Add proper state handling
Update example app with new state functionality
Merge pull request #18 from markbates/state

Add proper state handling