Changed to a nonblocking implementation.