significant inversion count - some minor changes