refactors add method that used duplicate code