extract these 2 lines in another function, will make it easier for the thread refactoring