Fixing some memory access issues + trying to fix rendering