updated templating
updated docs
several intermediate changes