finished part a and b