main code used for datamining on server