I've added some code comments, but `endswith` didn't seem to add any benefit.