Adding bbg data formatting function.