calculate values on construction