modified to use logger rather than print statements