Refactor template binder