Adds WindowsManager class. Various code was moved or rewritten to use this class.