gatefinder.cpp that now works since I have declared all the variables