included unistd.h to allow building on ubuntu 14.04 (compiler complains about undeclared usleep())