added keep_going variable