Change @key and @index to work off of scopes, add more functionality to it.