updated code to encapsulate entire bdf preprocessing stream