optimize weaver template