Move response validation out of main code.