Rearranged the functions, for some basic organization