add and function for pairs