added deterministic clustering