Converted To .net 4.5 and added some try catches