Improve crowding distance code.