Refactor: move analysis code to Analyzer class.