working trigger function, fuck yeah