re-arrange Dart to match original python source code