* use lastIndexOf as we are removing from the end