added code to capture division by zero and produce a useful error message.