partial implementation of part 2; testing needed