changing asynchronous to onclick