Fixed division by zero and added comments templates