cleanup imports, style, function naming
implemented faster record parsing by caching templates as format strings
fix reference bugs and format string issues
add 'cleanup' mode for generate record XML in addition to the new, faster template caching strategy
remove old debugging statements for measurable speed improvements