Moved type inspection out of read loop.