Fixed some minor errors and added some documentation.