fixed db stuff, played with tables, added some templates