Some refactors of HW2