main function update