new cli flags, documentation and refactoring