modularizing and pythonizing