refactored handling of finished jobs