replace parameter parsing with getopt, and add a way to change the port and drop privs