fixed issue with unique id
more schema and template changes