added exit, refactoring
test