extreme changes to make use of scikit_learn