Shared_vars option and some small cleanup