Handling sleep/alarm in a single block.