Added scope guard utility.