adding logic to take care of divide by zero