Code improvements as per review & perlcritic