Working on JS for dynamic reference parameters