Minor performance improvements (mostly string compare)
Fixed possible crash when opening a video file
Clean up namespaces.