cleaned up some parameter redundancy. have started testing.
fixed an out of bounds memory write error.