Please click here for code.

Each line is marked individually inside the code page.