Refactor production code