formatted and translated code that was emailed to me