Macroscheduling refactoring and fixes