added profiler and some caching