refactory template