Extracted functions that handled the type of text into their own module