Changed os.system call by subprocess.check_call to catch any problems while running shell commands