modified CodeTemplete