more work on edit template.. not close to done yet