Added detection for headswitching. (don't think this will remain here)