extract the add_from function