Update formatting logic