cleaned up weighting algorithm and added more verbosity