refactor zinnia_statistics for better code flow and coverage