[perf] reducing the number of platform.runlater calls to free up the ui thread ++ few refactorings