Replaced array checks by size method