change add_term function