Added preliminary add function and made more minor changes