Tidier approach that doesn't rely on a global