Added support for trigger attribute

Refactored code to use .data() exclusively, simplifying numerous evaluations throughout the script