Added some documentation and errors