added profiling module
added an optimized version of the script