improved database mapping, added entity info to templates, updated FormType