Wrapping function call in function to manage execution