rework internal queueing and add tests