building the foundation  function