more refactoring. osd window added.