Use getopts for argument parsing

And do a little clean up of project.