simplify scheduling code