modified add method