Added summary function and refactor
More refactoring and CLI work