chenge code format. move template in a separate file