Refactoring.

Eliminate writeLine' and withInvertedColors and unnecessary conditionals.
Formatting.