Trying optimize instead of sleep