Reorganized functions in utils to prevent ciricular import problem.