Added configurable sleep period.