added logic to base.js