cleanup  and create window structure