first version of kmens, really slow