Fixed an 'atEnd' bug and implemented some sampling to pull the CodeSystemVersion id.