clustering module code cleanup and formatting