split update into function for profiling purposes