change the implementation of add method