Fixed some bugs and initialized the export function

Fixed critical bug on multiple bpm
Start writing the osb export function