Updated mysql handling
Updates to template