Some work still to be done. Took care of seg fault