(OSD BRANCH) Reorganized osd code a bit (nw)