add proper options parsing using optparse
add a working example