Factor out BuildSchedule and fix some bugs in it. Rename $ModuleObjectToModuleBody -> $GetModuleBody.
Remove bogus definition of System at the end.