Improved python api