adding some code in an attempt to improve clustering