Fix issue #200. More Python refactorization