added visitor to keep track of weights