added sort_by method and test for checking the order of the hash returned by character_count