Task #2240 The clustering algorithm must receive the correct input

- Added the described treatment.