Define variable in correct scope