template cleanup, markdown integration, and partial template loading