Add documentation and do some error checking