add mode func snippet