First working version. No resume functionality yet. If the root path does not exist, there will be a segfault