This function could probably be assigned to a variable outside of the loop and not have to be generated every time