cleaned up some of the global functions, tied them in as members
of the main classes