HW2- little refactor