second big committ

everything compiles now but there is a seg fault.