Fixed some miniscule problems with count_inversions, but it's still broken. Will need to use templates...