Create a more generic execution function and update the returned values