Replaced try/catch with checking for count

Huh. Thought this would just add on to the existing PR, even though it's closed. A slightly cleaner implementation, which removes the try/catch. Works as before.