Refactored function to run command, make it more robust by using only ``subprocess.call`` function, updates to tests.