revamped the trigger function