Added some comments and documentation

Added some (initial) comments/documentation. This is very much work-in-progress, so we'll keep the documentation light for now.