outsourced run_command and added checks

you can now give cmd to checks and failur/success paths