Improve template.

Add stub for raytracing.
Clean up import order to avoid circular dependencies.
Add comments.