Modified the hasMore call to hasMoreElements