Changed list method to use recursion