reconstructed the design and decoupled contexts and windows (linux only)