refactored slightly to add regexes, passed the last test and added one for CD