Fixing seg faults and actually using malloc like a real person.