Refactoring for usage with threaded-application