better sleeptime logic