Add pair struct and functions