refactoring and sleeps