Convert CBS to scala