Custom templates, some other fixes