change sleep logic