completed part 2 with resolving errors