Finished part 3. Debugged so it compiles and runs. Not tested yet.