added logging functionality. -MM