switching template dom generation functionality