Better way of calculating in model