Added @throws tags, added tests for the exceptions