Little code refactoring.
Add DEBUG  public variable to control debug mode.
Log error on url opening to console.