re-added required function within function