Removed warnings and segfault when finalizing and added command line features, which do not really work.