Modified to allow usage of an external blocking queue.
Refactored codebase to split into packages.