Value array update moved to subroutine