Optimization. Added clustering