Fixed bug with connected lists.
Refactoring.