refact hw3