Updated HW4 so that the optimal solution is actually reached