added logic to alternative.js