Modify and retesting python code