Cleaned up code based on results of "perlcritic"