Add logfile + various interface improvements + code cleanups