Fixing VisualController security issues + some refactoring