merge scheduler code back into core