Refactor of frame reading.