Did some changes to everything. Crashes when running but not when using GDB.