Improve offline detection/switching, restore previous page after twitter login