almost finished with scanner. getting some seg fault error though