Update Algorithm