adding mode listener