refactor analysis in test.hs.