refactor auth; tables