update function main