Adds some documenting comments for various functions and templates