Add analyzedata method, reorgainze some of the methods