Implemented function addHashes for terms.