Dan writes a song and Meg cracks a code