fix trigger logic
refactor out