replace return with exit statements