Changed code to respond to invalid and arbitrary responses.