enhance scheduler and prepare unit test