Encapsulate list behaviour in the list class

Fixes #4