Add clip function from Terpstra