Updated smooth function