-Added support for gnu getopts (compiled but untested)
-Inserted some headers where required