Based on the Glad codebase by Richard Woolcock (aka KaVir).  See 'help glad'.