more refactoring of video example