Moving functions to utility file