Refactoring, saving and reciveing scheduler state