Massive reformat/cleanup/corrects to templates

These commits cleanup the markup and fix pathing errors, syntax issues, missing/extra tags, etc.  Also included is the ignoring of .pyc files, the removal of unused imports, and the removal of mixed tabs/spaces.