Implemented writeToSystemState for all relevant classes
Merged from master