Little refactoring, specially for PreviewWindow.