Logging, clean up old jobs, refactoring