fixed some bugs, added timing functions
added namespaces