New version with interrupt/thread support.