added debugging information to mode detection functions