updated for exit and die