Python improvements