Added error checking for step four, ready for final testing and submission to IR