Changed structure a bit, need to debug more segfaults