Moved the cluster_data template into its own header. Cleaned up the code slightly, and added some doc comments.