updated to latest copy, uses popen.