updated modes.js functions