Fix bad search'n'replace, thanks Ivan
Small tweaks
Document script_id and template databases

Also a bit of editing and organisation.