removed the sleep and added a std flush