add read-mode code.