Improve Python wrappers

Now most of the C++ functionality is exposed to Python.