simplified subprocess call, minor refactoring for readability