Fix closure pattern. Add doc