Added a test for the sleep function and a few lines of code cleanup