added demonstration for template module + fixed bugs