Massive refactor
Fix for state capitalization