Revert "Changed atexit call position and supplied function name"

This reverts commit 507eda50c1b5478b5f0ebc4ec2e2bf71a17bc277.