Rewritten the code to use simpler connections.