gluing code