Updated GIST function