gave logic to switch model and basic js)