added update function to front-end js