Fixed some problems with the regexs and turned the confirmation dialogue into a method.