assignment 6, part 3, source code