restructure auth