use .size() instead of counting manually