Cleanup of Dart code and improved performance