Refactor lots of cli. Fixed #4.