Refactor AnalyzeCommand

We should refactor the `AnalyzeCommand` class, as it is really messy.

refer #82