add templatetext endpoint
add templatetext endpoint and other improvements