added some utility functions
minor changes
added timing functions