improved for the Python interface