Refactor module definitions and custom data attached to connections.