Rewrote using getopt, cleaned up code, fixed .gitignore