Simplify sleep code