used isempty instead of zero length check