added some includes; fixed a few errors; still segfaulting