Vectorised modes.m