Some refactoring to allow a proper use of torrentfilx as a library in another programs