refactored hw1