implemented constructor and both versions of add()