Added exit funstionality