almost complete - introduced Segfault somewhere