refactor sdk and template