Refactor to get failing command error