change rank method so that count is stored as values in a hash