add proper logging and remove print statements