Simplify logic checks by using str methods, based on jamert's feedback