cleaner program

getopt(), better parsing, less errors.