Fixed hardware errors by setting environment variables. Switched to subprocess,Popen and also moved mining command into its own file.