refactoring
updated to use inheritance
supports adding object and array to initial object