working in 2 modes