added queue, more structuring