Implement Information Gain Weighted Distance Calculation

 - I have also done some minor refactoring of some of the code