Bugfix -- would return before getting to the end. Also, return value in one place only.