cleanup; move page and page template code to textutils for reuse