Reduce code footprint using a function to order keys