Optimized sign in and out