Switched all to getopt.
Actually check the right table.
Fixed whitespace / formating issues.
Merge pull request #2 from FrankGruellich/fixes

Fixes