code complete for scheduler part of code