Use abort instead of puts + exit.