finally finishing up this problem