updated so now base template can be loaded from file or can be placed inline