Updated access onclick function