fixed new read random condition. changed function variable names.