moving update into method