Refactors the OSD initialization.