add option for using a user provided memory block for reading into