Added some defense agaisnt null or empty lists