Small update to make the codes more pythonic