Move template render up one level

Templates are not always considered to be rendering html, hence the
reason for not including this class in the html folder
Fix table order in db tables file
Major db error detection fix