Replaced try/catch with checking for count