Refactoring
Added TState through all classes