last version of the code with new triggers