Additional documentation

Might as well document a little while reading the code. Correct me if I've misunderstood something!