implemented first part of exit. still needs save feature