added template extraction to LK