Refactored sleep