add the code of phase 2 task 2 without test

I haven't checked if the code works. If it crashes the program,
please let me know...