Refactor scheduling function to use time:stop keys