added case for empty list