Simplifying string check