Better error handling, more documentation.