refactor hw2