diff --git a/profman/boot_image_profile.cc b/profman/boot_image_profile.cc
index 89c9eb8..6715680 100644
--- a/profman/boot_image_profile.cc
+++ b/profman/boot_image_profile.cc
@@ -18,6 +18,7 @@
 #include <set>
 
 #include "boot_image_profile.h"
+#include "dex/class_accessor-inl.h"
 #include "dex/dex_file-inl.h"
 #include "dex/method_reference.h"
 #include "dex/type_reference.h"
@@ -74,38 +75,31 @@
       }
     }
     // Walk all of the classes and add them to the profile if they meet the requirements.
-    for (size_t i = 0; i < dex_file->NumClassDefs(); ++i) {
-      const DexFile::ClassDef& class_def = dex_file->GetClassDef(i);
-      TypeReference ref(dex_file.get(), class_def.class_idx_);
+    for (ClassAccessor accessor : dex_file->GetClasses()) {
+      TypeReference ref(dex_file.get(), accessor.GetClassIdx());
       bool is_clean = true;
-      const uint8_t* class_data = dex_file->GetClassData(class_def);
-      if (class_data != nullptr) {
-        ClassDataItemIterator it(*dex_file, class_data);
-        while (it.HasNextStaticField()) {
-          const uint32_t flags = it.GetFieldAccessFlags();
-          if ((flags & kAccFinal) == 0) {
-            // Not final static field will probably dirty the class.
-            is_clean = false;
-            break;
-          }
-          it.Next();
+      auto method_visitor = [&](const ClassAccessor::Method& method) {
+        const uint32_t flags = method.GetAccessFlags();
+        if ((flags & kAccNative) != 0) {
+          // Native method will get dirtied.
+          is_clean = false;
         }
-        it.SkipInstanceFields();
-        while (it.HasNextMethod()) {
-          const uint32_t flags = it.GetMethodAccessFlags();
-          if ((flags & kAccNative) != 0) {
-            // Native method will get dirtied.
-            is_clean = false;
-            break;
-          }
-          if ((flags & kAccConstructor) != 0 && (flags & kAccStatic) != 0) {
-            // Class initializer, may get dirtied (not sure).
-            is_clean = false;
-            break;
-          }
-          it.Next();
+        if ((flags & kAccConstructor) != 0 && (flags & kAccStatic) != 0) {
+          // Class initializer, may get dirtied (not sure).
+          is_clean = false;
         }
-      }
+      };
+      accessor.VisitFieldsAndMethods(
+          [&](const ClassAccessor::Field& field) {
+            if (!field.IsFinal()) {
+              // Not final static field will probably dirty the class.
+              is_clean = false;
+            }
+          },
+          /*instance_fields*/ VoidFunctor(),
+          method_visitor,
+          method_visitor);
+
       ++(is_clean ? clean_count : dirty_count);
       // This counter is how many profiles contain the class.
       size_t counter = 0;
diff --git a/profman/profman.cc b/profman/profman.cc
index 1f77239..661132d 100644
--- a/profman/profman.cc
+++ b/profman/profman.cc
@@ -43,6 +43,7 @@
 #include "boot_image_profile.h"
 #include "dex/art_dex_file_loader.h"
 #include "dex/bytecode_utils.h"
+#include "dex/class_accessor-inl.h"
 #include "dex/code_item_accessors-inl.h"
 #include "dex/dex_file.h"
 #include "dex/dex_file_loader.h"
@@ -929,21 +930,13 @@
       dex_resolved_classes.first->AddClass(class_ref.TypeIndex());
       std::vector<ProfileMethodInfo> methods;
       if (method_str == kClassAllMethods) {
-        // Add all of the methods.
-        const DexFile::ClassDef* class_def = dex_file->FindClassDef(class_ref.TypeIndex());
-        const uint8_t* class_data = dex_file->GetClassData(*class_def);
-        if (class_data != nullptr) {
-          ClassDataItemIterator it(*dex_file, class_data);
-          it.SkipAllFields();
-          while (it.HasNextMethod()) {
-            if (it.GetMethodCodeItemOffset() != 0) {
-              // Add all of the methods that have code to the profile.
-              const uint32_t method_idx = it.GetMemberIndex();
-              methods.push_back(ProfileMethodInfo(MethodReference(dex_file, method_idx)));
-            }
-            it.Next();
+        ClassAccessor accessor(*dex_file, *dex_file->FindClassDef(class_ref.TypeIndex()));
+        accessor.VisitMethods([&](const ClassAccessor::Method& method) {
+          if (method.GetCodeItemOffset() != 0) {
+            // Add all of the methods that have code to the profile.
+            methods.push_back(ProfileMethodInfo(method.GetReference()));
           }
-        }
+        });
       }
       // TODO: Check return values?
       profile->AddMethods(methods, static_cast<ProfileCompilationInfo::MethodHotness::Flag>(flags));
