Further modification to avoid zero divide error.