Add file regex check and refactor variable names.