add full grapi logic