move template into lib