Improve precision of scheduling and flushing
Use schedule for flushing