move sleep to the right place and delete unused red herring