Lets change this logic to use endsWith() since that is how the otther code works.