Tool is now usable again

... without memory leaks and invalig reads/writes!