Added check of empty list