moved logic from controllers to models, refactored queue order test