made some modifications to python solutions