give examples to show how to refactor properly