Fixed triggerObjects.js and refactored