added nonblocking function