Finish rewrite with better auth