rewrote system geometry creation, fixed lots of bad malloc uses