Implemented getopt_long() for parsing arguments.
Few bugs fixed. Program is almost complete now.