first portion of scheduler