Refactoring, some CLI stuff