applied 'text to the indentation function. clean up and rearrange code