Refactor: use getopt_long for arguments parsing