mostly functional template
minor tweaks
huge doc update