refactored out the Add fuction to a constructor