Adding error class to last_error reporting
Improving job spec querying for faster, priority based results