tests and implementation for `add/3`
minor refactoring of whitespace
types and specs for public functions