Add Exception Handling

All exceptions now are .net style and not C style.