Add exception handling to the main module
Delete deprecated TODOs
Bugfix  add parameter to the function call

"__cleanup_and_shutdown" was called without an error code