made some error out calls explicity exit and added some print statements