Brought back the earlier logic to normalize weights using the accumulated weight so far.