Segfault partially solved, C++ is harder than it looks.