refactor into tabExists fn