refactoring video-related functions