Cleanup of user switching code