some renamed functions; getTemplate added