Updated sketch with transmission code