improve names of globals, add debugging snippet to footer