variable scope with funcations