replaced calls to shell with Ruby