Working on fixing seg fault