Final comments added, all tests passing.

Fixed formatting, spaced out code for easier reading.