Back end: Refactored threading.