added profiler, taked map:update out of main loop