Program options revamp and general cleanup

Also added some tests for parsing ip addresses