code cleanup in clustering module