removed use of singletons and global variables. implemented the use of smart pointers to handle pointer clean up