home task 2 phase 2

refactoring, write in file