refactored to use OptionParser to improve interactivity, error handling and help