The task is done.

I am sorry for this code and hope your eyes won't bleed too much.