corrected implementation

Implementation corrected to not raise exceptions