Fixed some errors, and changed the doc writing