Moved some code to ScopSupport.