Code improvements as per perlcritic