Revamp logic to count jobs