Refactor/clean up scheduler API.