Basic K-Means algorithm. Still fairly slow, but seems quite effective.

Will start optimising.