The code is basically functional. I wouldn't call it robust, but it does return generally correct results.