pre-refactor commit

*added a safe_add function