modified to include print statements