Added sleep(double) so that you can pass in fractions of a second