Added some robustness to the counTo method.