added profiling and removed indexing for speed