modified to set the stackController property earlier.