removed unused parts. and enabled templates function