added --ends-with flag