added documentation and fixed typo in exception message