Refactored first homework