use Popen instead of system. Cosmetic changes