cleaned up imports and fixed escape key detection