added return statements where they were missing