use a queue

more safety and cleanup