Applied some of Perl Best Practices