Added possibility of specifying base template