improve Python interface