refactoring UI to include thread lock (for threads)