minor change so that valnr is always the last key in the array