refactoring into a command line util