This is much simpler. Not sure if strcmp() is best here though.