Code documentation

Lots and lots of documentation