Wrap code in immediate function