updated with better clustering