make lastIndexOf conditionals a bit easier to follow