update function call in a more js way works better