Scope variables correctly.