Added queue and fixed interval flushing