Refactor scheduler initialization.