complete refactor example