improved video setting code