Added init_sleep function