Rearranged and restructured how some functions are used.