use builtin python functions instead of use os.system