Revert "Revert "Replace scheduler with time""

This reverts commit 8d937fc08c37fd1cd013f147721eab2c8877a16c.