changed methods to throw all exceptions, and to work in O(1) for add remove set and get