Improve shutdown via callbacks