moved process stuff.
Added test files, fixed an infinite loop

Seg fault still exists.