Added parameters for writer and results queues, to avoid running out of memory