converted some scripts to python