Refactor indentation function