Refactor catalog worker code