move queue to outside of trigger