edited localized function