3rd part of HW2 working properly