implemented the Add function with all tests passed