Refacted the filehandle name, changed the regex in the foreach loop, made a few more 'optimizations'