Modified so app should quit properly on exit