Refactoring the (finite) Queue module.