Getops for command line options

Instead of complex $0, $1, etc just use getopts
Merge pull request #3 from gullevek/master

Getops for command line options