added options for reading from file or shared memory