try to migrate variable scope to class