Code cleanup, queue support