Altered class to use an internal length of the data list, and made this a parameter to the constructor