Refactoring Utils

This removes duplication regarding the `calculateIndent` function, adds missing docblocks, and adds tests for the `calculateIndent` function too.
Looks good to me, just we can do better at finding a fitting name for it, @keradus ?