Add scheduler function