More refactoring on webconnectino.js