can you extract some scopes here so this is easier to read?