fixed scheduling, divide processing into two functions