Made frequency summary algorithm more readable.