Refactored WritingState to separate file
WritingState to static C# class