Refactor out indentation detection