added a method that stores pair of elements