Refactor creation of video element