[PATCH 1/7] TRX: factor out the scheduler from remaining code