make scheduler take a generic thunk as argument