perlcritic, perltidy comments optimized, sub folding rewrited, performan...

Sub folding rewrited, now works as it should + several performance optimizations.