working on pair function