Queue refactor

Addresses issue #232.