added some things to windows like detect mode and handle it