added thread, timeout logic, working