Add self-invoking function