moving around some functions to organize