cherry pick refactor