Remove all defintions and copy them into templates