Added a function for the trigger search algorithm, Also created a main.h file for includes defines and globals.