slight refactor and added exit message