Updated exit status handling and general cleanup.