Exception logging updated
beautify code