smarty daemon, db data model reworked, templates fixes