added some flags, removed message event listeners