added ranks function