working
added trial randomization and fixed key dependence
fixing merge
fixed merge