Document the heuristic logic with some comments
Include the indent in the space-allocation calculation