finish check for both lisp Vars and externals variables, refactor into separate function