debugged add method