Added scope checking.