refactoring core for Dart backend.