added delete queue. Refactored