refactoring

also required for auth