Fix ambigous rank handling.
Create an ecotool.py helper.
Organize imports and variable order in ecotool.py.