Fixed NPE caused by incomplete mini-CBF headers and rewrote some bogus
code