fixed checking of video status
code indenting and some refactoring