Added code to create object code for Format1 and 2. Not tested, but logic looks right. Hope it works (probably won't)