Starting to write documentation. Also, fixed a bug.