merged andy_part2 and this branch. Seg faults. Not currently working.