Reorganize the pyhton part