Small refactoring and remove printing in command line