added parallel support to clustering