added documentation, removed minor mistakes