update function foreach, let the output looks more comfortable