Fixed typo in ID refresh control. Refactored OfflineState. Added comments.