Wrote thread safe data queue. NOT TESTED