Refactoring Utils

This removes duplication regarding the `calculateIndent` function, adds missing docblocks, and adds tests for the `calculateIndent` function too.
@ceeram I've ditched the count lines function because it doesn't work. Counting the number of `\n` is sufficient, so no utils function is needed.

Regarding changing the interface, that sounds like a good idea.