remove unnecessary variable, simply use len property of a list to check