added security guard and removed \n's