Removed regexec to separate file and added debugging