Main window implementation part.