adding logging to see how the program flows