week4 refactoring