optimize reading messages