finished the add function