Cleanup, use Popen, add linux and win support