Remove write logging and change loop conditions