corrected variable name, added return value