Fixed issues where the function wasn't being returned