Redesigned mode parsing