Prepare read function