Finished implementing add function