Modified prefix and suffix checking logic to use local_name