Refactoring for more sane jsPlumb connection handling