Implements  function