job queue refactoring