Confused about returning a variable list of objects from a subroutine