Try to re-implement this messy mess code - gives segfault still
right now at exit