removed debug output and re-added regex error catching