added logging and sleepy infinite loop code