using window object to add state control for different part