Refactor optimization process