Rewrite as an executable using OptionParser for dealing with flags