moved template to ui, removed some constructor calls, added preview