Merged ani's SDSOS/DSOS changes from SVN with some additions of my own