refactored to one single method for adding elements in the three