changed totally to python