made option of reading from file in each trial or on memory
remove huge comments