several refactorings and more to come. included new functionality for purging queues.