added exit functionality