code cleanup using perlcritic (almost level 3)